﻿// -----------------------------------------------------------------------
// <copyright file="TreeNode.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace ParserTree
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class TreeNode
    {
        public enum NodeType
        {
            program, factor, term, simpleExp, Exp, num, operationNode,
            ifNode, writeNode, readNode, assignNode, repeatNode, statmSeq,
            Statment, characterNode, identefier,
            comparisonNode, MulOpNode
        }
        public TreeNode right;
        public TreeNode left;
        public TreeNode middel;
        public NodeType Type;
        public string Value;
        public System.Windows.Forms.TreeNode tNode;

        public void convert()
        {
            string value = "";
            if (this.Value != null)
            {
                value = "(" + this.Value + ")";
            }
            tNode = new System.Windows.Forms.TreeNode(Type.ToString() + value);
            System.Windows.Forms.TreeNode LNode;
            System.Windows.Forms.TreeNode RNode;
            System.Windows.Forms.TreeNode MNode;
            if (right != null)
                tNode.Nodes.Add(right.tNode);
            if (left != null)
                tNode.Nodes.Add(left.tNode);
            if (middel != null)
                tNode.Nodes.Add(middel.tNode);
        }

    }

}
